<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>店铺属性</title>
        <script type="text/javascript" src="../common/js/common.js"></script>
        <script type="text/javascript" src="../common/js/dp/js/jquery-ui-1.8.6.custom.min.js"></script>
        <script type="text/javascript" src="../common/js/jquery-1.9.1.min.js"></script> 
        <script type="text/javascript" src="../common/js/jquery.jqGrid.min.js"></script>
        <script type="text/javascript" src="../common/js/grid.locale-cn.js"></script>
        
        <link href="../common/css/style1.css" rel="stylesheet" type="text/css"/>
        <link href="../common/css/ui.jqgrid.css" rel="stylesheet" type="text/css" />
        <link href="../common/js/dp/css/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript">
		    var $j = jQuery.noConflict();//以$j来替代jQuery中的$
	        function ShowMenu(id) {
	            var className = document.getElementById('menu' + id).className;
	            if(className.indexOf('curr')==-1)
	                document.getElementById('menu' + id).className = 'mouseover';
	            else
	                document.getElementById('menu' + id).className = 'curr mouseover';
	            document.getElementById('ul'+id).style.display = 'block';
	        }
	        function HideMenu(id) {
	            var className = document.getElementById('menu' + id).className;
	            if (className.indexOf('curr') == -1)
	                document.getElementById('menu' + id).className = '';
	            else
	                document.getElementById('menu' + id).className = 'curr';
	            document.getElementById('ul' + id).style.display = 'none';
	        }
	        var oldOld = null;
	        function ShowMenuDd(obj) {
	            if (oldOld == obj) return;
	            if (oldOld != null) {
	                oldOld.className = '';
	            }
	            obj.className = 'visible';
	            oldOld = obj;
	        }
	
	        var speed3 = 10; //速度数值越大速度越慢
	        var maxWidth = 0;
	        window.onload = function () {
	            maxWidth = document.getElementById("divScrollCommend").scrollWidth;
	            document.getElementById("tdScroll2").innerHTML = document.getElementById("tdScroll1").innerHTML;
	            var MyMar = setInterval(Marquee, speed3);
	            document.getElementById("divScrollCommend").onmouseover = function () { clearInterval(MyMar); };
	            document.getElementById("divScrollCommend").onmouseout = function () { MyMar = setInterval(Marquee, speed3); };
	        };
	
	        function Marquee() {
	            var left = parseInt(document.getElementById("divScrollCommend").style.left);
	            if (left + maxWidth == 0) {
	                left = 0;
	            }
	            else {
	                left--;
	            }
	            document.getElementById("divScrollCommend").style.left = left + 'px';
	        }
	        
	        function query(){
	        	var beginTime = $j("#begin_time").val();
				var endTime =  $j("#end_time").val();
				$j("#beginTime").val(beginTime);
				$j("#endTime").val(endTime);
				document.getElementById("myForm").submit();
	        }
    	</script>
  	</head>
    <body>
		<jsp:include page="../common/header.jsp" />          
	    <div class="Container">
	    	<div class="inquiry_box">
	            <table width="100%" border="0" cellpadding="0" cellspacing="0">
	                <tbody>
	                	<tr>
	                		<td width="10%"><strong>店铺属性</strong></td>
	                		<td></td>
	                	</tr>
	                </tbody>
	            </table>
	        </div>
	        <table id="list2"></table>
	        <div id="pager2"></div>
	    </div>
	    <br />
	    <div class="wrapdown">
	        <div class="footer">
	            <script type="text/javascript" src="../common/layout/footer.js"></script>
	        </div>
	    </div>
	    <script type="text/javascript">
		    jQuery(document).ready(function(){            
		        jQuery("#list2").jqGrid({
		        	// change the URL depend on your server path -> e.g. REST path
		            url:'jqgridServlet?datasource=stores',
		            datatype: "json",
		            colNames:['<strong>序</strong>', '店铺ID','店铺名称', '属性ID', '店铺属性', '修改时间', '修改用户', '功能'],
		            colModel:[
		                {name:'id',index:'id', width:30, align:"center", sortable:false},
		                {name:'no',index:'no', align:"center", width:100},
		                {name:'name',index:'name', align:"center", width:200},
		                {name:'attribute_id',index:'attribute_id', width:75, align:"center"},
		                {name:'attribute',index:'attribute', width:150, align:"center"},                
		                {name:'updatedt',index:'updatedt', width:120, align:"center"},
		                {name:'updateby',index:'updateby', width:100, align:"right"},
		                {name:'func',index:'func', width:200, align:"center", sortable:false}		
		            ],
		            rowNum:10,
		            rowList:[10,20,30],
		            pager: '#pager2',
		            sortname: 'no',
		            viewrecords: true,
		            sortorder: "desc",
		            loadComplete:function(data){             
		                $.each(data.rows,function(i){                        
		                    $("#"+data.rows[i].id).find("td").css("border","1px solid #CCCCCC");
		                    $("#"+data.rows[i].id).find("td").css("padding","5px");
		                    $("#" + data.rows[i].id).find("td").eq(0).css( "background-color", "#f0f0f0");                    
		                });
		                $('div .ui-jqgrid-bdiv').removeAttr("style");
		                $('#gview_list2 th').css({                    
		                    "border": "1px solid #B4D4DB",
		                    "background": "#E1F6FA",
		                    "font-weight": "normal",
		                    "color": "#555555",
		                    "vertical-align": "middle",
		                    "padding": "2px"
		                });
		                $('#gview_list2 th strong').css({                                        
		                    "font-weight": "bold",
		                    "color": "#0095b3"                    
		                });
		                
		                $('.ui-paging-info').css({
		                    "font-weight": "normal",
		                    "height":"19px",
		                    "margin-top": "3px",
		                    "margin-right": "40px"
		                });
		            },
		            gridComplete: function(){
		                var ids = jQuery("#list2").jqGrid('getDataIDs');
		                for(var i=0;i < ids.length;i++){
		                    var cl = ids[i];
		                    vi = "<input class='general' type='button' value='修改记录' title='修改记录' onclick=\"view('"+cl+"')\" style='margin-right:10px' />"; 
		                    ed = "<input class='general' type='button' value='编辑' title='编辑' onclick=\"edit('"+cl+"')\" style='margin-right:10px' />";  
		                    dl = "<input class='general' type='button' value='删除' title='删除' onclick=\"del('"+cl+"')\"  />"; 
		                    
		                    jQuery("#list2").jqGrid('setRowData',ids[i],{func:vi+ed});                    
		                }	
		            }
		        });
		        jQuery("#list2").jqGrid('navGrid','#pager2',{search:false,edit:false,add:false,del:false});
		    });
		    
		    function view(id ){
		        var no = $('#'+id).find('td').eq(1).text();
		        window.location.href="stores_logServlet?no="+no;
		    }
		    function edit(id){
		        var no = $('#'+id).find('td').eq(1).text();
		        window.location.href="store_editServlet?no="+no;
		    }
		    function del(id){
		        var store_id = $('#'+id).find('td').eq(1).text();
		        alert(store_id);
		    }
	    </script>
    </body>
</html>
